package com.wyh.common.utils.ali;

import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Getter
@Configuration
@ConfigurationProperties(prefix = "ali")
public class AliConfig {

    // getters and setters for captcha and oss
    private CaptchaConfig captcha;
    private OssConfig oss;

    @Getter
    public static class CaptchaConfig {
        // getters and setters
        private String ALIBABA_CLOUD_ACCESS_KEY_ID;
        private String ALIBABA_CLOUD_ACCESS_KEY_SECRET;
        private String SIGN_NAME;
        private String TEMPLATE_CODE;

        public void setALIBABA_CLOUD_ACCESS_KEY_ID(String ALIBABA_CLOUD_ACCESS_KEY_ID) {
            this.ALIBABA_CLOUD_ACCESS_KEY_ID = ALIBABA_CLOUD_ACCESS_KEY_ID;
        }

        public void setALIBABA_CLOUD_ACCESS_KEY_SECRET(String ALIBABA_CLOUD_ACCESS_KEY_SECRET) {
            this.ALIBABA_CLOUD_ACCESS_KEY_SECRET = ALIBABA_CLOUD_ACCESS_KEY_SECRET;
        }

        public void setSIGN_NAME(String SIGN_NAME) {
            this.SIGN_NAME = SIGN_NAME;
        }

        public void setTEMPLATE_CODE(String TEMPLATE_CODE) {
            this.TEMPLATE_CODE = TEMPLATE_CODE;
        }
    }

    @Getter
    public static class OssConfig {
        // getters and setters
        private String ENDPOINT;
        private String ACCESS_KEY_ID;
        private String ACCESS_KEY_SECRET;
        private String BUCKET_NAME;

        public void setENDPOINT(String ENDPOINT) {
            this.ENDPOINT = ENDPOINT;
        }

        public void setACCESS_KEY_ID(String ACCESS_KEY_ID) {
            this.ACCESS_KEY_ID = ACCESS_KEY_ID;
        }

        public void setACCESS_KEY_SECRET(String ACCESS_KEY_SECRET) {
            this.ACCESS_KEY_SECRET = ACCESS_KEY_SECRET;
        }

        public void setBUCKET_NAME(String BUCKET_NAME) {
            this.BUCKET_NAME = BUCKET_NAME;
        }
    }

    public void setCaptcha(CaptchaConfig captcha) {
        this.captcha = captcha;
    }

    public void setOss(OssConfig oss) {
        this.oss = oss;
    }

    @Getter
    private static AliConfig instance;

    public AliConfig() {
        instance = this;
    }

}
